/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.util.ConverterUtil;
import com.thor.palmmall.rest.chart.AMaintainReportData;
import com.thor.palmmall.spi.chart.SMaintainReportData;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class AMaintainReportDataConverter
    implements Converter<SMaintainReportData, AMaintainReportData> {

  public static AMaintainReportDataConverter getInstance() {
    if (instance == null)
      instance = new AMaintainReportDataConverter();
    return instance;
  }

  private static AMaintainReportDataConverter instance;

  private AMaintainReportDataConverter() {
  }

  @Override
  public AMaintainReportData convert(SMaintainReportData source) {
    if (source == null) {
      return null;
    }
    AMaintainReportData target = new AMaintainReportData();
    target.setQty(source.getQty());
    target.setDetials(
        ConverterUtil.convert(source.getDetails(), AMaintainDetialConverter.getInstance()));
    return target;
  }

}
